package io.finer.erp.jeecg.bas.service;

import io.finer.erp.jeecg.bas.dto.MaterialDTO;
import io.finer.erp.jeecg.bas.entity.ZrkQzOrdeDetail;
import io.finer.erp.jeecg.bas.entity.ZrkQzOrder;
import io.finer.erp.jeecg.bas.vo.CreateMesVO;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import io.finer.erp.jeecg.stock.entity.StkPickUpEntry;
import org.apache.ibatis.annotations.Param;
import org.jeecg.common.api.vo.Result;

/**
 * @Description: 分切/切张单
 * @Author: jeecg-boot
 * @Date:   2020-10-14
 * @Version: V1.0
 */
public interface IZrkQzOrderService extends IService<ZrkQzOrder> {

	/**
	 * @Description 根据生产订单获取切张\分切单
	 * @param orderId
	 * @return
	 * Create at: 2020-09-30 17:19:34
	 * @author: duanyong
	 * Revision:
	 *    2020-09-30 17:19:34 - first revision by duanyong
	 *        
	 */
	List<ZrkQzOrder> getQzOrderByOrderId(String orderId);
	
	/**
	 * 添加一对多
	 * 
	 */
	public void saveMain(ZrkQzOrder zrkQzOrder,List<ZrkQzOrdeDetail> zrkQzOrdeDetailList) ;
	
	/**
	 * 修改一对多
	 * 
	 */
	public void updateMain(ZrkQzOrder zrkQzOrder,List<ZrkQzOrdeDetail> zrkQzOrdeDetailList);
	
	/**
	 * 删除一对多
	 */
	public void delMain (String id);
	
	/**
	 * 批量删除一对多
	 */
	public void delBatchMain (Collection<? extends Serializable> idList);
	
	ZrkQzOrder checkByOrderProcessId(String orderProcessId);

	/**
	 * @Description 创建复合切张Mes单
	 * @param createMes
	 * @return
	 * Create at: 2020-12-23 09:15:34
	 * @author: duany
	 * Revision:
	 *    2020-12-23 09:15:34 - first revision by duany
	 *        
	 */
	Result<?> createMesFHQZ(CreateMesVO createMes);

	/**
	 * @Description 创建分切Mes单
	 * @param createMes
	 * @return
	 * Create at: 2020-12-24 15:53:33
	 * @author: duany
	 * Revision:
	 *    2020-12-24 15:53:33 - first revision by duany
	 *        
	 */
	Result<?> createMesFQ(CreateMesVO createMes);

	/**
	 * @Description 修改mes单状态为生产中
	 * @param id
	 * @return
	 * Create at: 2021-01-07 16:06:23
	 * @author: duany
	 * Revision:
	 *    2021-01-07 16:06:23 - first revision by duany
	 *        
	 */
	boolean changeStatusToProducing(String id);
	
	/**
	 * @Description 修改mes单状态
	 * @param id
	 * @param status
	 * @return
	 * Create at: 2021-01-07 17:17:17
	 * @author: duany
	 * Revision:
	 *    2021-01-07 17:17:17 - first revision by duany
	 *        
	 */
	boolean changeOrderStatus(String id, String status,String[] userIds);

	/**
	 * @Description 查询该出货单对应的物料
	 * @param id
	 * @return
	 * Create at: 2021-01-07 17:52:24
	 * @author: duany
	 * Revision:
	 *    2021-01-07 17:52:24 - first revision by duany
	 *        
	 */
	List<MaterialDTO> getMesMaterial(String id);

	List<ZrkQzOrder> getQzOrderByOrderProcessId(String id);

	List<ZrkQzOrder> getQzOrderByParentId(String parentId);

	/**
	 * 获取出库物料的物料分类id
	 * @param id
	 * @return
	 */
	List<String> getMesMaterials(String id);
	
	/**
	 * @Description 根据编号查询mes单
	 * @param code
	 * @return
	 * Create at: 2021-04-16 10:59:41
	 * @author: duany
	 * Revision:
	 *    2021-04-16 10:59:41 - first revision by duany
	 *        
	 */
	ZrkQzOrder getByCode(String code);

	/**
	 * 分页查询复合单信息
	 * @param page
	 * @param operatorUsers
	 * @param isFinish
	 * @param machineId
	 * @author: xu-zs
	 * Revision:
	 *    2021-04-14 11:24:24 - first revision by xu-zs
	 * @return
	 */
	IPage<ZrkQzOrder> getPageList(Page<ZrkQzOrder> page,ZrkQzOrder zrkQzOrder);
	
	/**
	 * @Description 分页查询分切单信息
	 * @param page
	 * @param zrkQzOrder
	 * @return
	 * Create at: 2021-09-03 10:48:47
	 * @author: xzs
	 * Revision:
	 *    2021-09-03 10:48:47 - first revision by xzs
	 *
	 */
	IPage<ZrkQzOrder> getPageFQList(Page<ZrkQzOrder> page,ZrkQzOrder zrkQzOrder);
	
	/**
	 * @Description 分页查询切张单信息
	 * @param page
	 * @param zrkQzOrder
	 * @return
	 * Create at: 2021-09-03 10:48:47
	 * @author: xzs
	 * Revision:
	 *    2021-09-03 10:48:47 - first revision by xzs
	 *
	 */
	IPage<ZrkQzOrder> getPageQZList(Page<ZrkQzOrder> page,ZrkQzOrder zrkQzOrder);
	
	Result<?> updateSortAsc(ZrkQzOrder zrkQzOrder);
	
	Result<?> updateSortDesc(ZrkQzOrder zrkQzOrder);
	
	/**
	 * mes单直接修改操作人及机器
	 * @param zrkQzOrder
	 * @author: xu-zs
	 * Revision:
	 *    2021-04-14 17:24:24 - first revision by xu-zs
	 * @return
	 */
	Result<?> updateUserAndMachine(ZrkQzOrder zrkQzOrder);
}
